fix: redirect logged-out users when clicking Follow on testimony#2063
fix: redirect logged-out users when clicking Follow on testimony#2063saschabuehrle wants to merge 1 commit intocodeforboston:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Mephistic
left a comment
There was a problem hiding this comment.
Thanks for picking this up!
Does this work for you locally? When I test this on the Vercel staging environment (e.g. https://maple-8x4dayz4v-maple-testimony.vercel.app/testimony/JEzCsV1OiC9hwCyrcON5A/1 ) when logged out, it does not redirect and I see an error: Uncaught (in promise) FirebaseError: Missing or insufficient permissions.
I think this is because we actually have two different Follow button components - the one modified in this PR, and the one on the Testimony Detail page the bug happens for. It looks like the follow actions here are defined in the TestimonyDetailPage component and passed as props to the PolicyActions component.
Bug
Issue #2059 reports that logged-out users can click the Follow button on a testimony page, but nothing happens.
Fix
This PR updates
BaseFollowButtonto redirect unauthenticated users to the login page when they click follow/unfollow.router.push('/login?redirect=...')with the current pathThis makes the button behavior consistent with the rest of the app’s auth-protected flows.
Testing
YARN_IGNORE_ENGINES=1 yarn check-typesYARN_IGNORE_ENGINES=1 ./node_modules/.bin/eslint components/shared/FollowButton.tsxHappy to address any feedback.
Greetings, saschabuehrle